package com.fla.puzzle.ui;

import com.danikula.aibolit.Aibolit;
import com.danikula.aibolit.annotation.InjectView;
import com.fla.puzzle.R;
import com.fla.puzzle.pack.PackItem;
import com.fla.puzzle.utils.Utils;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;

public class ImageViewerActivity extends Activity {
    private static final String PACK_ITEM_KEY = OptionsActivity.class.getName() + "PACK_ITEM_KEY";

    @InjectView(R.id.imageView)
    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        Aibolit.setInjectedContentView(this, R.layout.image_viewer_activity);

        PackItem packItem = (PackItem) getIntent().getSerializableExtra(PACK_ITEM_KEY);
        ImageLoader.getInstance().displayImage(Utils.toURI(packItem.getImageId()).toString(), imageView);
    }

    public static void start(Context context, PackItem packItem) {
        context.startActivity(new Intent(context, ImageViewerActivity.class).putExtra(PACK_ITEM_KEY, packItem));
    }
}
